/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background-color: #4CAF50;
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header h1 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 2.5rem;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

nav ul li {
    margin: 0 15px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

nav ul li a:hover {
    background-color: rgba(255,255,255,0.2);
}

/* 主区域样式 */
main {
    padding: 40px 0;
}

.hero {
    text-align: center;
    margin-bottom: 60px;
}

.hero h2 {
    font-size: 2.2rem;
    margin-bottom: 20px;
    color: #4CAF50;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 40px;
    color: #666;
}

.game-cards {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.game-card {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    flex: 1;
    min-width: 300px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.game-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #333;
}

.game-card p {
    margin-bottom: 20px;
    color: #666;
}

.btn {
    display: inline-block;
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #45a049;
}

/* 特色区域样式 */
.features {
    background-color: white;
    padding: 40px 0;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.features h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #4CAF50;
    font-size: 2rem;
}

.feature-list {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.feature {
    flex: 1;
    min-width: 300px;
    text-align: center;
    padding: 20px;
}

.feature h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
}

.feature p {
    color: #666;
}

/* 游戏页面通用样式 */
.game-container {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
}

.game-info-item {
    font-size: 1.2rem;
    font-weight: bold;
}

.game-area {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.game-instructions {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.game-instructions h3 {
    margin-bottom: 10px;
    color: #4CAF50;
}

.game-instructions ul {
    list-style-position: inside;
    color: #666;
}

.game-instructions li {
    margin-bottom: 5px;
}

/* 贪吃蛇游戏样式 */
#snakeCanvas {
    border: 2px solid #4CAF50;
    background-color: #f0f8f0;
}

/* 俄罗斯方块游戏样式 */
#tetrisCanvas {
    border: 2px solid #4CAF50;
    background-color: #000;
}

/* 记忆翻牌游戏样式 */
.memory-game {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.memory-card {
    width: 100px;
    height: 100px;
    background-color: #4CAF50;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: white;
    transition: transform 0.3s, background-color 0.3s;
    position: relative;
    perspective: 1000px;
}

.memory-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.memory-card.flipped .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card-front, .memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
}

.memory-card-front {
    background-color: #4CAF50;
    color: white;
}

.memory-card-back {
    background-color: #fff;
    color: #333;
    transform: rotateY(180deg);
    border: 2px solid #ddd;
}

/* 设置页面样式 */
.settings-container {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.settings-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input[type="range"] {
    cursor: pointer;
}

/* 移动端响应式设计 */
@media (max-width: 768px) {
    .game-cards,
    .feature-list {
        flex-direction: column;
    }
    
    .game-card,
    .feature {
        min-width: auto;
    }
    
    .memory-game {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .memory-card {
        width: 80px;
        height: 80px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
}

/* 页脚样式 */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

footer p {
    margin: 0;
}